<?php
/**
 * Created by PhpStorm.
 * User: zhangjian37
 * Date: 2016/9/16
 * Time: 21:40
 */

$RootDir = $_SERVER['DOCUMENT_ROOT'];
include $RootDir . '/utils/mysql/MysqlUtils.php';
include $RootDir . '/utils/CommonConstant.php';

$curtime = time();
//通过user_name得到手机，邮箱，密保
$user_name = $_POST['user_name'];
$phone = $_POST['phone'];
$check = $_POST['check'];

$conn = conn_mysql();
//判断验证码是否正确
$query = "select count(1) as cout from phone_check where phone = '$phone' and check_info = '$check' and $curtime BETWEEN starttime AND endtime";
$result = queryRecord($query,$conn);
while ($row=mysql_fetch_array($result, MYSQL_ASSOC)) {
    $cout = $row['cout'];
}
if ($cout != 1 )die("err: 验证码不对".$query);
else echo 'OK';